package com.feixiang.springbootinit.model.vo.SessionArchive;
import com.feixiang.springbootinit.model.enums.SessionArchiveMsgActionEnum;
import com.feixiang.springbootinit.model.enums.SessionArchiveMsgTypeEnum;
import lombok.Data;
import java.util.List;
@Data
/**
 * 会话存档消息解密数据
 */
public class SessionArchiveMsgVO {
    private String msgid;//消息id，消息的唯一标识，企业可以使用此字段进行消息去重
    /**
     * @see SessionArchiveMsgActionEnum
     */
    private String action;//消息动作，目前有send(发送消息)/recall(撤回消息)/switch(切换企业日志)三种类型
    private String from;//消息发送方id。同一企业内容为userid，非相同企业为external_userid。消息如果是机器人发出，也为external_userid
    private List<String> tolist;//息接收方列表，可能是多个，同一个企业内容为userid，非相同企业为external_userid。数组
    private String roomid;//群聊消息的群id。如果是单聊则为空
    private Long msgtime;//消息发送时间戳，utc时间，ms单位

    /**
     * @see SessionArchiveMsgTypeEnum
     */
    private String msgtype;
    /**
     * 机器人与外部联系人的账号都是external_userid，其中机器人的external_userid是以"wb"开头，
     * 例如："wbjc7bDwAAJVylUKpSA3Z5U11tDO4AAA"，外部联系人的external_userid以"wo"或"wm"开头。
     * 如果是机器人发出的消息，可以通过openapi拉取机器人详情：如何获取机器人详情？
     * 如果是外部联系人发出的消息，可以通过openapi拉取外部联系人详情：如何获取外部联系人详情？
     * 如果是引用/回复消息，发消息的用户的语言设置是中文，消息内容前面会加上“这是一条引用/回复消息：”，如果发消息的用户的语言设置是英文，消息内容的前面会加上“This is a quote/reply:”。
     */
    private Long time;//action=switch才有
    private String user;//action=switch才有

    //msgtype = meeting_voice_call才有
    private String voiceid;
    private meeting_voice_call meeting_voice_call;

    //msgtype=voip_doc_share 才有
    private String voipid;
    private voip_doc_share voip_doc_share;

    //msgtype=external_redpacket才有  !! 注意，消息类型为redpacket也有这个  所以这里注释掉  留一个
    //private redpacket redpacket;

    //msgtype=sphfeed 才有
    private Long feed_type;
    private String sph_name;
    private String feed_desc;

    //msgtype=voiptext才有
    private Long callduration;
    private Long invitetype;

    //msgtype=qydiskfile才有
    private info info;// ? 文档不清晰


    private Text text;
    private Image image;
    private Revoke revoke;
    private Disagree disagree;
    private Agree agree;
    private Voice voice;
    private Video video;
    private Card card;
    private Location location;
    private Emotion emotion;

    private File file;
    private Link link;
    private Weapp weapp;
    private Chatrecord chatrecord;
    private Todo todo;
    private Vote vote;
    private Collect collect;
    private Redpacket redpacket;
    private Meeting meeting;
    private meeting_notification meeting_notification;

    private docmsg docmsg;
    private markdown markdown;
    private news news;
    private calendar calendar;
    private mixed mixed;

    @Data
    public static class info {
        private String filename;
    }

    /*@Data
    public static class redpacket {
        private Long type;
        private String wish;
        private Long totalcnt;
        private Long totalamount;
    }*/

    @Data
    public static class voip_doc_share {
        private String filename;
        private String md5sum;
        private Long filesize;
        private String sdkfileid;
    }

    @Data
    public static class meeting_voice_call {
        private Long endtime;
        private String sdkfileid;
        private List<demofiledata> demofiledata;
        private List<sharescreendata> sharescreendata;

        @Data
        public static class demofiledata {
            private String filename;
            private String demooperator;
            private Long starttime;
            private Long endtime;
        }

        @Data
        public static class sharescreendata {
            private String share;
            private Long starttime;
            private Long endtime;
        }
    }

    @Data
    public static class Text {
        private String content;
    }

    @Data
    public static class Image {
        private String md5sum;
        private Long filesize;
        private String sdkfileid;
    }

    @Data
    public static class Revoke {
        private String pre_msgid;
    }

    @Data
    public static class Disagree {
        private String userid;
        private Long agree_time;//文档不清晰，到底是这个字段 还是下面的字段 ？
        private Long disagree_time;
    }

    @Data
    public static class Agree {
        private String userid;
        private Long agree_time;
    }

    @Data
    public static class Voice {
        private Long voice_size;
        private Long play_length;
        private String sdkfileid;
        private String md5sum;
    }

    @Data
    public static class Video {
        private Long filesize;
        private Long play_length;
        private String sdkfileid;
        private String md5sum;
    }

    @Data
    public static class Card {
        private String corpname;
        private String userid;//名片所有者的id，同一公司是userid，不同公司是external_userid。String类型
    }


    @Data
    public static class Location {
        private Double longitude;
        private Double latitude;
        private String address;
        private String title;
        private Long zoom;
    }

    @Data
    public static class Emotion {
        private Integer type;//1表示gif 2表示png
        private Integer width;
        private Integer height;
        private String sdkfileid;
        private String md5sum;
        private Long imagesize;
    }

    @Data
    public static class File {
        private String sdkfileid;
        private String md5sum;

        private String filename;
        private String fileext;

        private Long filesize;
    }

    @Data
    public static class Link {
        private String title;
        private String description;

        private String link_url;
        private String image_url;

    }

    @Data
    public static class Weapp {
        private String title;
        private String description;

        private String username;
        private String displayname;

    }

    @Data
    public static class Chatrecord {
        private String title;
        private List<Item> item;

        @Data
        public static class Item {
            private String type;//每条聊天记录的具体消息类型：ChatRecordText/ ChatRecordFile/ ChatRecordImage/ ChatRecordVideo/ ChatRecordLink/ ChatRecordLocation/ ChatRecordMixed ….
            private Long msgtime;
            private String content;
            private Boolean from_chatroom;

        }
    }


    @Data
    public static class Todo {
        private String title;
        private String content;
    }

    @Data
    public static class Vote {
        private String votetitle;
        private List<String> voteitem;
        private Integer votetype;
        private String voteid;
    }

    @Data
    public static class Collect {
        private String room_name;
        private String creator;
        private String create_time;
        private String title;
        private List<Detail> details;

        @Data
        public static class Detail {
            private Long id;
            private String ques;
            private String type;//有Text(文本),Number(数字),Date(日期),Time(时间)。String类型
        }
    }


    @Data
    public static class Redpacket {
        private Long type;//1 普通红包、2 拼手气群红包、3 激励群红包
        private String wish;
        private Long totalcnt;
        private Long totalamount;
    }

    @Data
    public static class Meeting {
        private String topic;
        private Long starttime;
        private Long endtime;
        private String address;
        private String remarks;
        private Long meetingid;
    }

    @Data
    public static class meeting_notification {
        private Long meetingid;
        private Long notification_type;
        private String content;

    }

    @Data
    public static class docmsg {
        private String title;
        private String link_url;
        private String doc_creator;
    }

    @Data
    public static class markdown {
        private String info;////?  啥格式
    }

    @Data
    public static class news {
        private info info;

        @Data
        public static class info {
            private List<item> item;

            @Data
            public static class item {
                private String title;
                private String description;
                private String url;
                private String picurl;

            }
        }
    }


    @Data
    public static class calendar {
        private String title;
        private String creatorname;
        private List<String> attendeename;
        private Long starttime;
        private Long endtime;
        private String place;
        private String remarks;
    }

    @Data
    public static class mixed {
        private List<item> item;

        @Data
        public static class item {
            private String type;//是上面各类消息的type
            private String content;//type不同   content不同  json
        }
    }
}